Add test for --package and virtual manifest
authorAleksey Kladov <aleksey.kladov@gmail.com>
Mon, 12 Dec 2016 12:57:19 +0000 (15:57 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Mon, 12 Dec 2016 13:05:19 +0000 (16:05 +0300)
closes #3194

tests/workspaces.rs

index 00bb68bd43dd7786d70de0f46aefd7ddcf42548c..579dfa0dbfea77e194591fb8f8ae466a1970c0dc 100644 (file)
@@ -624,6 +624,28 @@ fn virtual_works() {
     assert_that(&p.root().join("bar/Cargo.lock"), is_not(existing_file()));
 }
 
+#[test]
+fn explicit_package_argument_works_with_virtual_manifest() {
+    let p = project("foo")
+        .file("Cargo.toml", r#"
+            [workspace]
+            members = ["bar"]
+        "#)
+        .file("bar/Cargo.toml", r#"
+            [project]
+            name = "bar"
+            version = "0.1.0"
+            authors = []
+        "#)
+        .file("bar/src/main.rs", "fn main() {}");
+    p.build();
+    assert_that(p.cargo("build").cwd(p.root()).args(&["--package", "bar"]),
+                execs().with_status(0));
+    assert_that(&p.root().join("Cargo.lock"), existing_file());
+    assert_that(&p.bin("bar"), existing_file());
+    assert_that(&p.root().join("bar/Cargo.lock"), is_not(existing_file()));
+}
+
 #[test]
 fn virtual_misconfigure() {
     let p = project("foo")